import time
import math

class Counter:
    def __init__(self):
        self.hash = {}

    def update(self, new):
        if new in self.hash:
            self.hash[new] += 1
        else:
            self.hash[new] = 1

    def show(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %d" % (key, self.hash[key])

    def __str__(self):
        keys = self.hash.keys()
        keys.sort()
        str = ""
        for key in keys:
            str += "\n\t%s: %d" % (key, self.hash[key])
        return str

class CounterTime(Counter):
    granule = 60
    format = "%Y-%m-%d %H:%M:%S"
    def update(self, new):
        (date_time, dummy, vpn, port, user, client, server) = new
        date_time = time.strftime(CounterTime.format, 
                           time.localtime(math.ceil(time.mktime(time.strptime(date_time, CounterTime.format)) / CounterTime.granule) * CounterTime.granule))
        if date_time in self.hash:
            self.hash[date_time][0].update(vpn)
            self.hash[date_time][1].update(port)
            self.hash[date_time][2].update(user)
            self.hash[date_time][3].update(client)
            self.hash[date_time][4].update(server)
        else:
            self.hash[date_time] = (Counter(), Counter(), Counter(), Counter(), Counter())
            self.hash[date_time][0].update(vpn)
            self.hash[date_time][1].update(port)
            self.hash[date_time][2].update(user)
            self.hash[date_time][3].update(client)
            self.hash[date_time][4].update(server)
    def show_vpn(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %s" % (key, self.hash[key][0])
    def show_port(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %s" % (key, self.hash[key][1])
    def show_user(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %s" % (key, self.hash[key][2])
    def show_client(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %s" % (key, self.hash[key][3])
    def show_server(self):
        keys = self.hash.keys()
        keys.sort()
        for key in keys:
            print "%s: %s" % (key, self.hash[key][4])

with file('mmm2') as inFile:
    date_time_counter = CounterTime()
    for line in inFile:
        date_time_counter.update(line.strip().split('\t'))
    date_time_counter.show_vpn()
    date_time_counter.show_port()
    date_time_counter.show_user()
    date_time_counter.show_client()
    date_time_counter.show_server()
